// 导入相关控件
import 'package:flutter/material.dart';
import './components/list.dart';
import './components/love.dart';

import './components/layout.dart';

void main() => runApp(MyApp());

// 控件 无状态控件 有状态控件
class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: '泽楠',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
      ),
      home: MyHome(),
    );
  }
}

class MyHome extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 3,
      child: Scaffold(
        appBar: AppBar(
          title: Text('泽楠'),
          centerTitle: true,
          actions: <Widget>[],
        ),
        drawer: Container(
            decoration: BoxDecoration(color: Colors.blue),
            child: ListView(
              padding: EdgeInsets.all(0),
              children: <Widget>[
                UserAccountsDrawerHeader(
                  accountEmail: Text('泽楠的邮箱'),
                  accountName: Text('泽楠'),
                  currentAccountPicture: CircleAvatar(
                      backgroundImage: NetworkImage(
                          'https://ftp.bmp.ovh/imgs/2020/09/42b06a523b5d5795.png')),
                  decoration: BoxDecoration(
                      image: DecorationImage(
                          fit: BoxFit.cover,
                          image: NetworkImage(
                              'http://b.hiphotos.baidu.com/zhidao/pic/item/8601a18b87d6277f9f0b14032a381f30e924fceb.jpg'))),
                ),
                ListTile(
                  title: Text('用户反馈'),
                  trailing: Icon(Icons.feedback),
                ),
                Divider(
                  color: Colors.black,
                ),
                ListTile(
                  title: Text('用户反馈'),
                  trailing: Icon(Icons.feedback),
                ),
                ListTile(
                  title: Text('用户反馈'),
                  trailing: Icon(Icons.feedback),
                ),
              ],
            )),
        bottomNavigationBar: Container(
          decoration: BoxDecoration(
            color: Colors.black,
          ),
          height: 50,
          child: TabBar(
              labelStyle: TextStyle(height: 0, fontSize: 10),
              tabs: <Widget>[
                Tab(
                  icon: Icon(Icons.movie_filter),
                  text: '泽楠学霸',
                ),
                Tab(
                  icon: Icon(Icons.movie_filter),
                  text: '泽楠美女',
                ),
                Tab(
                  icon: Icon(Icons.movie_filter),
                  text: '泽楠美图',
                ),
              ]),
        ),
        body: TabBarView(children: <Widget>[
          List(
            mt: '电影',
          ),
          Love(mt: '大美女'),
          Layout(),
        ]),
      ),
    );
  }
}
